package com.itheima.mycollection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionDemo2 {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<String>();
        collection.add("坂田大郎");
        collection.add("坂田次郎");
        collection.add("坂田太郎");

        Iterator<String> name = collection.iterator();

        while (name.hasNext()){
            String next = name.next();
            System.out.println("name = " + next);
        }
    }
}
